home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / shrlk201.zip / _SETUP.1 / Main.pas < prev    next >
Pascal/Delphi Source File  |  1997-07-22  |  2KB  |  84 lines

  1. unit Main;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, ExtCtrls, Spin;
  8.  
  9. const
  10.   DLLName = 'KeyGen.DLL';
  11.  
  12. type
  13.   TfrmUnlockGenerator = class(TForm)
  14.     txtUserName: TEdit;
  15.     txtPrivateKey: TEdit;
  16.     lblUserName: TLabel;
  17.     lblPrivateKey: TLabel;
  18.     seExtension: TSpinEdit;
  19.     rgUnlockType: TRadioGroup;
  20.     lblExtensionLength: TLabel;
  21.     btnGenerateKey: TButton;
  22.     Bevel1: TBevel;
  23.     txtCodeOut: TEdit;
  24.     lblCode: TLabel;
  25.     procedure seExtensionChange(Sender: TObject);
  26.     procedure btnGenerateKeyClick(Sender: TObject);
  27.     procedure rgUnlockTypeClick(Sender: TObject);
  28.     procedure txtUserNameChange(Sender: TObject);
  29.     procedure txtPrivateKeyChange(Sender: TObject);
  30.   private
  31.   public
  32.   end;
  33.  
  34. function GenerateKey(sName, sPrivateKey: pchar; iExtension: integer): pchar; stdcall; external DLLName name 'GenerateKey';
  35.  
  36.  
  37. var
  38.   frmUnlockGenerator: TfrmUnlockGenerator;
  39.  
  40. implementation
  41.  
  42. {$R *.DFM}
  43.  
  44. procedure TfrmUnlockGenerator.seExtensionChange(Sender: TObject);
  45. begin
  46.   if seExtension.Value = 0 then rgUnlockType.ItemIndex := 0
  47.   else rgUnlockType.ItemIndex := 1;
  48.   txtCodeOut.Text := '';
  49. end;
  50.  
  51. procedure TfrmUnlockGenerator.btnGenerateKeyClick(Sender: TObject);
  52. begin
  53.   txtCodeOut.Text := GenerateKey(pchar(txtUserName.Text), pchar(txtPrivateKey.Text), seExtension.Value);
  54. end;
  55.  
  56. ///////////////////////////////////////////////////////////
  57.  
  58. procedure TfrmUnlockGenerator.rgUnlockTypeClick(Sender: TObject);
  59. begin
  60.   if rgUnlockType.ItemIndex = 0 then
  61.     begin
  62.       seExtension.Enabled := False;
  63.       seExtension.Value := 0;
  64.       lblExtensionLength.Enabled := False;
  65.     end
  66.   else
  67.     begin
  68.       seExtension.Enabled := True;
  69.       lblExtensionLength.Enabled := True;
  70.     end;
  71. end;
  72.  
  73. procedure TfrmUnlockGenerator.txtUserNameChange(Sender: TObject);
  74. begin
  75.   txtCodeOut.Text := '';
  76. end;
  77.  
  78. procedure TfrmUnlockGenerator.txtPrivateKeyChange(Sender: TObject);
  79. begin
  80.   txtCodeOut.Text := '';
  81. end;
  82.  
  83. end.
  84.